import { GSprite } from "../../../../com/mui/controls/GSprite";
import { ResouceConst } from "../../../component/gconst/ResouceConst";
import { ObjCreate } from "../common/ObjCreate";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
//class TextBox
    
    export  class TextBox extends GSprite
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            this._bg = ResouceConst.getScaleBitmap("DisabledBg");
            this.addChild(this._bg);
            this._text = ObjCreate.createGTextField("", 0, 0);
            this.addChild(this._text);
            if (this._label) 
            {
                this._text.text = this._label;
            }
            if (this._htmlText) 
            {
                this._text.htmlText = this._htmlText;
            }
            if (this._textFieldWidth) 
            {
                this._text.width = this._textFieldWidth;
            }
            if (this._bgWidth) 
            {
                this._bg.width = this._bgWidth;
                this._text.width = this._bgWidth;
            }
            if (this._bgHeight) 
            {
                this._bg.height = this._bgHeight;
                this._text.height = this._bgHeight;
            }
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            this._bg.dispose();
            this._text.dispose();
            return;
        }

        public get textField(): Object /* flash.text.TextField */
        {
            return this._text;
        }

        public set label(arg1: string)
        {
            this._label = arg1;
            this._text.text = arg1;
            return;
        }

        public get label(): string
        {
            return this._label;
        }

        public set htmlText(arg1: string)
        {
            this._htmlText = arg1;
            this._text.htmlText = arg1;
            return;
        }

        public get htmlText(): string
        {
            return this._htmlText;
        }

        public set textFieldWidth(arg1: number)
        {
            this._textFieldWidth = arg1;
            this._text.width = arg1;
            return;
        }

        public set textFieldHeight(arg1: number)
        {
            this._textFieldHeight = arg1;
            this._text.height = arg1;
            return;
        }

        public set bgWidth(arg1: number)
        {
            this._bgWidth = arg1;
            this._bg.width = arg1;
            this._text.width = arg1;
            return;
        }

        public get bgWidth(): number
        {
            return this._bg.width;
        }

        public set bgHeight(arg1: number)
        {
            this._bgHeight = arg1;
            this._bg.height = arg1;
            this._text.height = arg1;
            return;
        }

        public get bgHeight(): number
        {
            return this._bg.height;
        }

        public set defaultTextFormat(arg1: Object /* flash.text.TextFormat */)
        {
            this._text.defaultTextFormat = arg1;
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            this._label = "";
            this._htmlText = "";
            this._bgWidth = 0;
            this._bgHeight = 0;
            this._textFieldWidth = 100;
            this._textFieldHeight = 20;
            super.dispose(arg1);
            return;
        }

        public /* var */_text: GTextFiled;

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_label: string;

        /* internal */ /* var */_htmlText: string;

        /* internal */ /* var */_bgWidth: number;

        /* internal */ /* var */_bgHeight: number;

        /* internal */ /* var */_textFieldWidth: number;

        /* internal */ /* var */_textFieldHeight: number;
    }
